package com.prp.gwt.client.widgets.user.article;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.prp.gwt.client.user.article.ArticleListener;
import com.prp.gwt.client.vo.SubjectCategoryList;

public class SideBar extends VerticalPanel{

	public static SideBar instance;
	Image refreshImage = new Image(GWT.getModuleBaseURL() + "loading.gif");
	
	public static SideBar getInstance(){
		return instance;
	}
	
	public SideBar(){
		instance = this;
		ArticleListener.getInstance().getSubjectCategoryList();
		addStyleName("article-sidebar");
		add(refreshImage);
	}
	
	public void load(SubjectCategoryList list){
		refreshImage.setVisible(false);
		for(int i = 0; i < list.size(); i++)
			add(new SideBarCategory(list.get(i)));
	}
	
}
